package main

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"github.com/spf13/viper"
	"shop-api/config"
	"shop-api/databases/migrate"
	"shop-api/middleware"
	"shop-api/router"
)

func main() {
	fmt.Println("1123444444")
	fmt.Println("1123444444")
	fmt.Println("1123444444")
	r := gin.Default()
	r.Use(middleware.Cors())

	router.Register(r)
	config.InitConfig()

	err := migrate.Migrate()
	if err != nil {
		panic(err)
	}

	r.Run(fmt.Sprintf(":%v", viper.GetString("server.port"))) // 监听并在 0.0.0.0:8080 上启动服务
}
